﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using WMSSoft.Lib.Basic;
using WMSSoft.WinKStart.ViewModel;

namespace WMSSoft.WinKStart
{
    /// <summary>
    /// Interaktionslogik für ChooseFilter.xaml
    /// </summary>
    public partial class ChooseFilterDlg : Window
    {
        public ChooseFilterDlg()
        {
            InitializeComponent();
        }

        private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        {
            try
            {
                SingleStartFolderItemViewModel tmpItem = (WMSSoft.WinKStart.ViewModel.SingleStartFolderItemViewModel)((TreeView)sender).SelectedItem;
                ((ChooseFilterDlgViewModel)this.DataContext).SelectedItem = tmpItem; 
            }
            catch (Exception Ex)
            {
                CMessagelogging.AppendMessage("Error while changing selected Node!", Ex, true, EMessageTypes.Error);
            }
        }
    }
}
